#ifndef PROMOTIONMANAGERWINDOW_H
#define PROMOTIONMANAGERWINDOW_H

#include <QWidget>
#include <QSqlDatabase>
#include <QSqlQueryModel>
#include "ui_promotionmanagerwindow.h"

class PromotionManagerWindow : public QWidget
{
    Q_OBJECT

public:
    explicit PromotionManagerWindow(QSqlDatabase db, QWidget *parent = 0);
    ~PromotionManagerWindow();

signals:
    void returnRequested();

private slots:
    void on_pushButtonCreate_clicked();
    void on_pushButtonClear_clicked();
    void on_pushButtonReturn_clicked();
    void on_pushButtonDelete_clicked();
    void on_pushButtonEdit_clicked();
    void on_pushButtonLoad_clicked();

    // 补充函数声明
    void loadProductsToCombo();
    void loadActivitiesToTable();

private:
    Ui::PromotionManagerWindow *ui;
    QSqlDatabase m_db;
    QSqlQueryModel *m_activityModel;
    int m_editingActivityId = -1;
    bool m_isProcessing = false;

    double getProductPrice(const QString& productName);

    // 若不需要 m_isEditPromptShown，可删除相关代码；若需要则补充定义
    // bool m_isEditPromptShown = false;
};

#endif // PROMOTIONMANAGERWINDOW_H
